With highly development and improvement of image-processing techniques, various electronic apparatuses including web camera, digital camera, cellular and picture phone, personal digital assistant (PDA), multimedia computer, etc., take advantages of these techniques to get well developed and enhanced. In order to facilitate rapid transmission of the digital images, the images are usually compressed, for example, in JPEG or MPEG compression operation before the image transmission. Full color images, perhaps presented in RGB format, however, cannot be compressed in JPEG or MPEG compression operation unless they are converted into images presented in a compressible format, for example, YCbCr (digital YUV) format.
Please refer to FIG. 1 which is a schematic diagram illustrating RGB to YCbCr conversion of an image frame. A full color image frame consists of m columns and n rows of pixels is practically stored as three sub-frames including a red frame IR, a green frame IG and a blue frame IB, each of which consists of m columns and n rows of pixel values. After color space transformation T, a luminance frame Y, a blue-chrominance frame Cb and a red-chrominance frame Cr, each of which consists of m columns and n rows of luminance values or chrominance values, are generated. The following equations are applicable to the color space transformation to get the Y, Cb and Cr values:Y(i)=0.299R(i)+0.587G(i)+0.114B(i)Cb(i)=−0.168R(i)−0.331G(i)+0.499B(i)Cr(i)=0.500R(i)−0.419G(i)−0.081B(i)where i is the serial number of the pixel of interest.
Afterwards, the image frame presented by the luminance frame Y, the blue-chrominance frame Cb and the red-chrominance frame Cr is ready to be compressed. The image frame is sampled portion by portion as illustrated in FIG. 1, and the basic processing unit 11, 12, 13, for example, is 8×8 pixels or 16×16 pixels. For executing JPEG compression, the image portions are sampled, discrete cosine transformed (DCT), quantized, and entropy coded in sequence.
Giving a basic processing unit consisting of 16 columns and 16 rows of pixels as an example, the image portions 11, 12 and 13 all have 16 columns and 16 rows of pixel values. The Y-component portion 11 consists of four 8×8 blocks Y1, Y2, Y3 and Y4 arranged as a 2×2 array. The same arrangement is applied to the Cb-component portion 12 and the Cr-component portion 13 to provide eight 8×8 blocks Cb1, Cb2, Cb3, Cb4, Cr1, Cr2, Cr3 and Cr4.
The image portions are then compressed according to one of the sub-sampling algorithms conventionally used for JPEG compression, for example 4:4:4, 4:2:2, 4:2:0, 4:1:1 or 2:1:1 sub-sampling algorithms. Through the sub-sampling operation, a minimum coded unit (MCU) for compression will be obtained.
FIG. 2(a) illustrates the 4:1:1 sub-sampling algorithm. The Y-component portion 11, the Cb-component portion 12 and the Cr-component portion 13 are processed by operators S11, S12 and S13 to result in the minimum coded unit M11 consisting of unit portions 111, 112 and 113, respectively. The Y-component unit portion 111 is identical to the Y-component portion 11 consisting of four 8×8 blocks Y1, Y2, Y3 and Y4. The Cb-component portion 12 is converted into the Cb-component unit portion 112 consisting of an 8×8 block Cb′ by averaging the pixel values of four blocks Cb1, Cb2, Cb3 and Cb4 as the pixel values of the block Cb′. Similarly, the new Cr-component unit portion 113 consisting of an 8×8 block Cr′ is obtained by averaging the four blocks Cr1, Cr2, Cr3 and Cr4 of the Cr-component portion 13. Alternatively, the blocks Cb′ and Cr′ can be a selected one or respective portions, e.g. Cb1 and Cr1. The six blocks Y1, Y2, Y3, Y4, Cb′ and Cr′ map to four pixel arrays [Y1, Cb′, Cr′], [Y2, Cb′, Cr′], [Y3, Cb′, Cr′] and [Y4, Cb′, Cr′].
FIG. 2(b) illustrates the 2:1:1 sub-sampling algorithm wherein the resulting minimum coded unit (MCU) consists of 2-block Y-component portion, 1-block Cb-component portion and 1-block Cr-component portion. The Y-component portion 11, the Cb-component portion 12 and the Cr-component portion 13 are processed into unit portions 211a, 212a, 213a, 211b, 212b and 213b by operators S21, S22 and S23. One new Y-component portion 211a consists of blocks Y1 and Y2, and the other new Y-component portion 211b consists of Y3 and Y4. The two blocks Cb1′ and Cb2′ of the new Cb-component portions 212a and 212b are obtained by averaging the two blocks Cb1 and Cb2 and the two blocks Cb3 and Cb4, respectively. Similarly, the two blocks Cr1′ and Cr2′ of the new Cr-component portions 213a and 213b are obtained by averaging the two blocks Cr1 and Cr2 and the two blocks Cr3 and Cr4, respectively. The resulting four Y-component blocks, two Cb-component blocks and two Cr-component blocks are divided into two minimum coded unit (MCU) M21 consisting of blocks Y1, Y2, Cb1′ and Cr1′ and minimum coded unit (MCU) M22 consisting of blocks Y3, Y4, Cb2′ and Cr2′. The eight blocks Y1, Y2, Y3, Y4, Cb1′, Cb2′, Cr1′ and Cr2′ map to four pixel arrays [Y1, Cb1′, Cr1′], [Y2, Cb1′, Cr1′], [Y3, Cb2′, Cr2′] and [Y4, Cb2′, Cr2′].
FIG. 2(c) illustrates the 4:4:4 sub-sampling algorithm wherein all the blocks wherein all the blocks Y1, Y2, Y3, Y4, Cb1, Cb2, Cb3, Cb4, Cr1, Cr2, Cr3 and Cr4 remain to constitute a minimum coded unit (MCU) M31 through the processing of operators S31, S32 and S33 to obtain new unit portions 311, 312 and 313. The 4:4:4 sub-sampling is also called “no chroma sub-sampling” or “lossless sub-sampling”. The twelve blocks Y1, Y2, Y3, Y4, Cb1, Cb2, Cb3, Cb4, Cr1, Cr2, Cr3 and Cr4 map to four pixel blocks [Y1, Cb1, Cr1], [Y2, Cb2, Cr2], [Y3, Cb3, Cr3] and [Y4, Cb4, Cr4].
After the sub-sampling operation, the minimum coded unit M11, M21, M22 or M31 is loaded into memory. According to the 4:1:1 sub-sampling algorithm, the minimum coded unit M11 occupies storage space equivalent to six 8×8 blocks. On the other hand, a storage space equivalent to eight 8×8 blocks is required to store the minimum coded units M21 and M22 according to the 2:1:1 sub-sampling algorithm, and a storage space equivalent to twelve 8×8 blocks is required to store the minimum coded unit 31 according to the 4:4:4 sub-sampling algorithm. There is need to reduce the size of the minimum coded unit so as to save the storage space of memory.